package com.lt.lumentracks.controller;


import com.lt.lumentracks.entity.po.Tag;
import com.lt.lumentracks.entity.vo.common.Result;
import com.lt.lumentracks.entity.vo.tag.TagVO_info;
import com.lt.lumentracks.service.ITagService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;
import com.lt.lumentracks.constant.RedisConstant;

import java.util.List;

/**
 * <p>
 * 标签表 前端控制器
 * </p>
 *
 * @author swl
 * @since 2025-07-22
 */
@RestController
@RequestMapping("/tag")
public class TagController {

    @Autowired
    private ITagService iTagService;


    // 查询所有标签
    @GetMapping("/getAllTag")
    public Result<List<Tag>> getAllTag(){
        List<Tag> list = iTagService.list();
        return Result.success(list);
    }

    // 查询所有状态正常的标签，返回其部分信息
    @GetMapping("/getNormalTag")
    @Cacheable(cacheNames = RedisConstant.POST_TAG_KEY, key = "'tagList'")
    public Result<List<TagVO_info>> getNormalTag(){
        List<TagVO_info> list = iTagService.getNormalTag();
        return Result.success(list);
    }


}
